package sword.T66;

/**
 * @Author: 18362
 * @Create: 2022-04-10 20:13:08 星期日
 */
class Solution {
    public int[] constructArr(int[] a) {
        if (a.length == 0)
            return new int[]{};
        int[] b = new int[a.length];
        b[0] = 1;
        for (int i=1; i<a.length; ++i) {
            b[i] = b[i-1] * a[i-1];
        }
        int prod = 1;
        for (int i=a.length-2; i>=0; --i) {
            prod *= a[i+1];
            b[i] *= prod;
        }
        return b;
    }
}
